<%@ page import="java.util.List" %>
<%@ page import="com.bjpowernode.user.Dynamic" %>
<%@ page import="java.util.Iterator" %>
<%
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" +
            request.getServerPort() + request.getContextPath() + "/";
%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <base href="<%=basePath%>">
</head>
<body>
<%
    List<Dynamic> dynamicList = (List<Dynamic>) request.getAttribute("dynamicList");
%>
    <script type="text/javascript" src="jQuery/jquery-3.5.1.js"></script>
    <script type="text/javascript">
        <%
            String name = (String) session.getAttribute("username");
        %>
        function sc(scid,name){
            $.ajax({
                url:"collect/add.do",
                data:{
                    username:"<%=name%>",
                    name:name,
                    scid:scid
                },
                success:function(response){
                    alert(response);
                }
            })
        }
    </script>
<%
    if (dynamicList.size() == 0){
%>
    这里空空如也，此用户还没有发过微博。。。
<%
    }
    Iterator<Dynamic> it = dynamicList.iterator();
    while(it.hasNext()){
        Dynamic dynamic = it.next();
%>
        <table style="border-bottom: 1px solid rgba(0,0,0,0.23)">
            <tr>
                <td colspan="3"><%=dynamic.getUsername()%></td>
            </tr>
            <tr>
                <td colspan="3"><%=dynamic.getFbtime()%></td>
            </tr>
            <tr>
                <td colspan="3"><%=dynamic.getDt()%></td>
            </tr>
            <tr>
                <td onclick="sc(<%=dynamic.getId()%>,'<%=dynamic.getUsername()%>')" style="cursor: pointer">收藏</td>
                <td>评论</td>
                <td>点赞</td>
            </tr>
        </table>
<%
    }

%>
</body>
</html>
